package com.sdy.common.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zzq on 2019/1/13.
 */
public class ThreadLocalUtil {
    private static List<ThreadLocal> requestThreadLocalVarList = new ArrayList<>();
    
    public static <T> ThreadLocal<T> createRequestThreadLocal() {
        ThreadLocal<T> var = new ThreadLocal<>();
        requestThreadLocalVarList.add(var);
        return var;
    }

    public static void clearRequestThreadLocal() {
        requestThreadLocalVarList.forEach(ThreadLocal::remove);
    }
}
